.class final Lcom/ninesky/browser/view/d;
.super Landroid/app/Dialog;

# interfaces
.implements Landroid/text/TextWatcher;


# instance fields
.field private final a:Z

.field private b:Landroid/webkit/WebView;

.field private c:Landroid/widget/TextView;

.field private d:Lcom/ninesky/browser/BrowserActivity;

.field private e:Lcom/ninesky/browser/n;

.field private f:Landroid/widget/EditText;

.field private g:Landroid/view/View;

.field private h:Landroid/view/View;

.field private i:Landroid/view/View$OnClickListener;

.field private j:Landroid/view/View$OnClickListener;


# direct methods
.method public constructor <init>(Lcom/ninesky/browser/BrowserActivity;Lcom/ninesky/browser/n;)V
    .locals 1

    const v0, 0x7f080004

    invoke-direct {p0, p1, v0}, Landroid/app/Dialog;-><init>(Landroid/content/Context;I)V

    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/ninesky/browser/view/d;->a:Z

    new-instance v0, Lcom/ninesky/browser/view/bf;

    invoke-direct {v0, p0}, Lcom/ninesky/browser/view/bf;-><init>(Lcom/ninesky/browser/view/d;)V

    iput-object v0, p0, Lcom/ninesky/browser/view/d;->i:Landroid/view/View$OnClickListener;

    new-instance v0, Lcom/ninesky/browser/view/be;

    invoke-direct {v0, p0}, Lcom/ninesky/browser/view/be;-><init>(Lcom/ninesky/browser/view/d;)V

    iput-object v0, p0, Lcom/ninesky/browser/view/d;->j:Landroid/view/View$OnClickListener;

    iput-object p1, p0, Lcom/ninesky/browser/view/d;->d:Lcom/ninesky/browser/BrowserActivity;

    iput-object p2, p0, Lcom/ninesky/browser/view/d;->e:Lcom/ninesky/browser/n;

    const/4 v0, 0x1

    invoke-virtual {p0, v0}, Lcom/ninesky/browser/view/d;->setCanceledOnTouchOutside(Z)V

    return-void
.end method

.method private a()V
    .locals 3

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->d:Lcom/ninesky/browser/BrowserActivity;

    const-string v1, "input_method"

    invoke-virtual {v0, v1}, Lcom/ninesky/browser/BrowserActivity;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Landroid/view/inputmethod/InputMethodManager;

    iget-object v1, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    invoke-virtual {v1}, Landroid/widget/EditText;->getWindowToken()Landroid/os/IBinder;

    move-result-object v1

    const/4 v2, 0x0

    invoke-virtual {v0, v1, v2}, Landroid/view/inputmethod/InputMethodManager;->hideSoftInputFromWindow(Landroid/os/IBinder;I)Z

    return-void
.end method

.method private a(I)V
    .locals 5

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->d:Lcom/ninesky/browser/BrowserActivity;

    invoke-virtual {v0}, Lcom/ninesky/browser/BrowserActivity;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const/high16 v1, 0x7f0a

    const/4 v2, 0x1

    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    invoke-static {p1}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    aput-object v4, v2, v3

    invoke-virtual {v0, v1, p1, v2}, Landroid/content/res/Resources;->getQuantityString(II[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v0

    iget-object v1, p0, Lcom/ninesky/browser/view/d;->c:Landroid/widget/TextView;

    invoke-virtual {v1, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    return-void
.end method

.method static synthetic a(Lcom/ninesky/browser/view/d;)V
    .locals 0

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->c()V

    return-void
.end method

.method static synthetic b(Lcom/ninesky/browser/view/d;)Landroid/webkit/WebView;
    .locals 1

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    return-object v0
.end method

.method private b()V
    .locals 2

    const/4 v1, 0x0

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->h:Landroid/view/View;

    invoke-virtual {v0, v1}, Landroid/view/View;->setEnabled(Z)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->g:Landroid/view/View;

    invoke-virtual {v0, v1}, Landroid/view/View;->setEnabled(Z)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->h:Landroid/view/View;

    invoke-virtual {v0, v1}, Landroid/view/View;->setFocusable(Z)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->g:Landroid/view/View;

    invoke-virtual {v0, v1}, Landroid/view/View;->setFocusable(Z)V

    return-void
.end method

.method private c()V
    .locals 3

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    if-nez v0, :cond_0

    new-instance v0, Ljava/lang/AssertionError;

    const-string v1, "No WebView for FindDialog::findNext"

    invoke-direct {v0, v1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V

    throw v0

    :cond_0
    iget-object v0, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    const/4 v1, 0x1

    invoke-virtual {v0, v1}, Landroid/webkit/WebView;->findNext(Z)V

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->a()V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->d:Lcom/ninesky/browser/BrowserActivity;

    const-string v1, "Find"

    const-string v2, "Next"

    invoke-static {v0, v1, v2}, Lcom/mobclick/android/c;->a(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    return-void
.end method

.method static synthetic c(Lcom/ninesky/browser/view/d;)V
    .locals 0

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->a()V

    return-void
.end method

.method static synthetic d(Lcom/ninesky/browser/view/d;)Lcom/ninesky/browser/BrowserActivity;
    .locals 1

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->d:Lcom/ninesky/browser/BrowserActivity;

    return-object v0
.end method

.method private d()V
    .locals 4

    const/4 v3, 0x0

    const/4 v2, 0x1

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    if-nez v0, :cond_0

    new-instance v0, Ljava/lang/AssertionError;

    const-string v1, "No WebView for FindDialog::onTextChanged"

    invoke-direct {v0, v1}, Ljava/lang/AssertionError;-><init>(Ljava/lang/Object;)V

    throw v0

    :cond_0
    iget-object v0, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    invoke-virtual {p0}, Lcom/ninesky/browser/view/d;->getWindow()Landroid/view/Window;

    move-result-object v1

    invoke-virtual {v1}, Landroid/view/Window;->getDecorView()Landroid/view/View;

    move-result-object v1

    invoke-virtual {v1}, Landroid/view/View;->getHeight()I

    move-result v1

    invoke-virtual {v0, v1}, Landroid/webkit/WebView;->setFindDialogHeight(I)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    invoke-virtual {v0}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v0

    invoke-interface {v0}, Ljava/lang/CharSequence;->length()I

    move-result v1

    if-nez v1, :cond_2

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->b()V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    invoke-virtual {v0}, Landroid/webkit/WebView;->clearMatches()V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->c:Landroid/widget/TextView;

    const/4 v1, 0x4

    invoke-virtual {v0, v1}, Landroid/widget/TextView;->setVisibility(I)V

    :cond_1
    :goto_0
    return-void

    :cond_2
    iget-object v1, p0, Lcom/ninesky/browser/view/d;->c:Landroid/widget/TextView;

    invoke-virtual {v1, v3}, Landroid/widget/TextView;->setVisibility(I)V

    iget-object v1, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    invoke-interface {v0}, Ljava/lang/CharSequence;->toString()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v0

    invoke-virtual {v1, v0}, Landroid/webkit/WebView;->findAll(Ljava/lang/String;)I

    move-result v0

    invoke-direct {p0, v0}, Lcom/ninesky/browser/view/d;->a(I)V

    const/4 v1, 0x2

    if-ge v0, v1, :cond_3

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->b()V

    if-nez v0, :cond_1

    invoke-direct {p0, v3}, Lcom/ninesky/browser/view/d;->a(I)V

    goto :goto_0

    :cond_3
    iget-object v0, p0, Lcom/ninesky/browser/view/d;->h:Landroid/view/View;

    invoke-virtual {v0, v2}, Landroid/view/View;->setFocusable(Z)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->g:Landroid/view/View;

    invoke-virtual {v0, v2}, Landroid/view/View;->setFocusable(Z)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->h:Landroid/view/View;

    invoke-virtual {v0, v2}, Landroid/view/View;->setEnabled(Z)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->g:Landroid/view/View;

    invoke-virtual {v0, v2}, Landroid/view/View;->setEnabled(Z)V

    goto :goto_0
.end method


# virtual methods
.method final a(Landroid/webkit/WebView;)V
    .locals 0

    iput-object p1, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    return-void
.end method

.method public final afterTextChanged(Landroid/text/Editable;)V
    .locals 0

    return-void
.end method

.method public final beforeTextChanged(Ljava/lang/CharSequence;III)V
    .locals 0

    return-void
.end method

.method public final dismiss()V
    .locals 1

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->a()V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    invoke-virtual {v0}, Landroid/webkit/WebView;->clearMatches()V

    invoke-super {p0}, Landroid/app/Dialog;->dismiss()V

    return-void
.end method

.method public final dispatchKeyEvent(Landroid/view/KeyEvent;)Z
    .locals 3

    const/4 v2, 0x1

    invoke-virtual {p1}, Landroid/view/KeyEvent;->getKeyCode()I

    move-result v0

    invoke-virtual {p1}, Landroid/view/KeyEvent;->getAction()I

    move-result v1

    if-ne v1, v2, :cond_1

    move v1, v2

    :goto_0
    sparse-switch v0, :sswitch_data_0

    :cond_0
    invoke-super {p0, p1}, Landroid/app/Dialog;->dispatchKeyEvent(Landroid/view/KeyEvent;)Z

    move-result v0

    :goto_1
    return v0

    :cond_1
    const/4 v1, 0x0

    goto :goto_0

    :sswitch_0
    iget-object v0, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    invoke-virtual {v0}, Landroid/widget/EditText;->hasFocus()Z

    move-result v0

    if-eqz v0, :cond_0

    if-eqz v1, :cond_2

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->c()V

    :cond_2
    move v0, v2

    goto :goto_1

    nop

    :sswitch_data_0
    .sparse-switch
        0x17 -> :sswitch_0
        0x42 -> :sswitch_0
    .end sparse-switch
.end method

.method protected final onCreate(Landroid/os/Bundle;)V
    .locals 3

    invoke-super {p0, p1}, Landroid/app/Dialog;->onCreate(Landroid/os/Bundle;)V

    invoke-virtual {p0}, Lcom/ninesky/browser/view/d;->getWindow()Landroid/view/Window;

    move-result-object v1

    const/16 v0, 0x57

    invoke-virtual {v1, v0}, Landroid/view/Window;->setGravity(I)V

    const v0, 0x7f030029

    invoke-virtual {p0, v0}, Lcom/ninesky/browser/view/d;->setContentView(I)V

    const/4 v0, -0x1

    const/4 v2, -0x2

    invoke-virtual {v1, v0, v2}, Landroid/view/Window;->setLayout(II)V

    const v0, 0x7f0c0083

    invoke-virtual {p0, v0}, Lcom/ninesky/browser/view/d;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/EditText;

    iput-object v0, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    const v0, 0x7f0c0082

    invoke-virtual {p0, v0}, Lcom/ninesky/browser/view/d;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iget-object v2, p0, Lcom/ninesky/browser/view/d;->i:Landroid/view/View$OnClickListener;

    invoke-virtual {v0, v2}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    iput-object v0, p0, Lcom/ninesky/browser/view/d;->g:Landroid/view/View;

    const v0, 0x7f0c0081

    invoke-virtual {p0, v0}, Lcom/ninesky/browser/view/d;->findViewById(I)Landroid/view/View;

    move-result-object v0

    iget-object v2, p0, Lcom/ninesky/browser/view/d;->j:Landroid/view/View$OnClickListener;

    invoke-virtual {v0, v2}, Landroid/view/View;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    iput-object v0, p0, Lcom/ninesky/browser/view/d;->h:Landroid/view/View;

    const v0, 0x7f0c0084

    invoke-virtual {p0, v0}, Lcom/ninesky/browser/view/d;->findViewById(I)Landroid/view/View;

    move-result-object v0

    check-cast v0, Landroid/widget/TextView;

    iput-object v0, p0, Lcom/ninesky/browser/view/d;->c:Landroid/widget/TextView;

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->b()V

    const/4 v0, 0x4

    invoke-virtual {v1, v0}, Landroid/view/Window;->setSoftInputMode(I)V

    return-void
.end method

.method public final onTextChanged(Ljava/lang/CharSequence;III)V
    .locals 2

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->d()V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->e:Lcom/ninesky/browser/n;

    iget-object v1, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    invoke-virtual {v1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/ninesky/browser/n;->a(Ljava/lang/String;)V

    return-void
.end method

.method public final show()V
    .locals 4

    invoke-super {p0}, Landroid/app/Dialog;->show()V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    invoke-virtual {v0}, Landroid/widget/EditText;->requestFocus()Z

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    iget-object v1, p0, Lcom/ninesky/browser/view/d;->e:Lcom/ninesky/browser/n;

    invoke-virtual {v1}, Lcom/ninesky/browser/n;->a()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/EditText;->setText(Ljava/lang/CharSequence;)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    invoke-virtual {v0}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v0

    const/4 v1, 0x0

    invoke-interface {v0}, Landroid/text/Spannable;->length()I

    move-result v2

    const/16 v3, 0x12

    invoke-interface {v0, p0, v1, v2, v3}, Landroid/text/Spannable;->setSpan(Ljava/lang/Object;III)V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    invoke-virtual {v0}, Landroid/widget/EditText;->selectAll()V

    iget-object v0, p0, Lcom/ninesky/browser/view/d;->b:Landroid/webkit/WebView;

    iget-object v1, p0, Lcom/ninesky/browser/view/d;->f:Landroid/widget/EditText;

    invoke-virtual {v1}, Landroid/widget/EditText;->getText()Landroid/text/Editable;

    move-result-object v1

    invoke-interface {v1}, Landroid/text/Editable;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/String;->trim()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/webkit/WebView;->findAll(Ljava/lang/String;)I

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->b()V

    invoke-direct {p0}, Lcom/ninesky/browser/view/d;->d()V

    return-void
.end method
